# To change this template, choose Tools | Templates
# and open the template in the editor.

__author__="furoscame"
__date__ ="29.12.11 20:27"
debug = True

class MosalMessage():
    """
    The parsed MOSAL message
    """
    def __init__(self, message):
        self.message = message
        self.message_data = {}

#        self.level = 0
#        self.address = 0
#        self.data = ""
#        self.move = ""
#        self.duration = 0
#        self.frequency = 0

    pass
    def get(self, data_name):
        try:
            data_value = self.message_data[data_name]
            #print ("data", data_value)
        except:

            print ("Access to Nonmember!")
            self.print_message()
            #data_value = ""
        return data_value
        pass
    pass

    def set(self, data_name, data_value):
        self.message_data[data_name] = data_value
        pass
    pass

    def has_data(self,data_name):
        try:
            data_value = self.message_data[data_name]
            return True
            #print ("data", data_value)
        except:
            return False
        pass

    def print_message(self):
        if debug == True:
            print ("Dump Message Data")
        for name, val in self.message_data.iteritems():
            print (name, val)
        pass
        return "End Message Data"
         
    pass
pass

